#include <cstdio>

int main() {
    const int MAX = 100000;
    int a[MAX+10] = {0};
    int k, e, count = 0;

    while (scanf("%d%d", &k, &e) != EOF) {
        a[e] = k;
    }
    for (int i = 1; i <= MAX; i++) {
        a[i-1] = a[i] * i;
        a[i] = 0;
        if (a[i-1] != 0) count++;
    }
    if (count == 0) printf("0 0");
    else {
        for (int i = MAX; i >= 0; i--) {
            if (a[i] != 0) {
                printf("%d %d", a[i], i);
                count--;
                if (count != 0) printf(" ");
            }
        }
    }

    return 0;
}